/*
 *  mytest.cpp
 *  
 *
 *  Created by XIAO Rong on 10-02-16.
 *  Copyright 2010 PKU. All rights reserved.
 *
 */
#include <iostream>
using namespace std;

class base {
protected:
	int gen;
	base(int g){gen=g; num+=1;};
public:
	static int num;
};

//static base::num=0;

class child : private base {
private:
	int get_gen(){
		cout << "this is a "<< base::num << " object!\n";
		return gen;};
public:
	child(int g):base(g){get_gen();};
	friend int get_gen_fr(child* c){return c->gen;};
};

//static int 
int base::num=0;
main(){
	
	child *carr[10];
	//child ch(0),ch1(20);
	///*
	 for (int i=0; i<10; i++) {
		//ch=child(i);
		carr[i]=new child(i); 	
		 cout << carr[i] << ": "<< get_gen_fr(carr[i])<< endl;
	};
	 //*/
}